#pragma once

#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <string>
#include <clocale>
#include <algorithm>
#include <vector>


using namespace std;





// Reverses the string "s" in place, but there is a bug
void incorrect_reverse_string(char* s)
{
	int n = strlen(s);
	for (int i = 0; i < n; ++i)
	{
		char temp = s[i];
		s[i] = s[n - i - 1];
		s[n - i - 1] = temp;
	}
}


// Reverses the string "s" in place
void reverse_string(char* s)
{
	int n = strlen(s);
	for (int i = 0; i < n / 2; ++i)
	{
		char temp = s[i];
		s[i] = s[n - i - 1];
		s[n - i - 1] = temp;
	}
}







int main(){

	setlocale(LC_ALL, "swedish");

	char s1[] = "abc";
	char s2[] = "abc";

	incorrect_reverse_string(s1);

	reverse_string(s2);

	cout << s1 << endl;

	cout << s2 << endl;
	


	system("pause");
	return 0;
}

